package com.lz.app.demo.dao;

import java.util.List;

import com.lz.app.demo.domain.TblLanzuoMeeting;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * @Title: TblLanzuoMeetingDao
 * @ProjectName app-service
 * @Author huchao
 * @Date 2018/9/5下午1:58
 */
public interface TblLanzuoMeetingDao extends JpaRepository<TblLanzuoMeeting, Integer> {

	@Query(value = "SELECT * FROM TBL_LANZUO_MEETING where USER_ID = ?1 ORDER BY ID DESC", nativeQuery = true)
	List<TblLanzuoMeeting> listByOwnId(Integer userid);

	@Query(value = "SELECT M.* FROM TBL_LANZUO_MEETING_MEMBER MM " +
			"LEFT JOIN TBL_LANZUO_MEETING M ON MM.MEETING_ID = M.ID where MM.USER_ID = ?1 ORDER BY M.ID DESC", nativeQuery = true)
	List<TblLanzuoMeeting> listByUserId(Integer userid);

	TblLanzuoMeeting findById(Integer id);

}
